const axios = require('axios')
const baseURL = 'http://localhost:3000'

// 按id获取商品分类信息
export async function getCategoryById(params) {
  console.log('按id获取商品分类信息')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/getCategoryById',
    data: {
      params
    }
  })
}

// 删除图片
export async function delCategoryImg(params) {
  console.log('删除图片数据')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/delCategoryImg',
    data: {
      file_id: params
    }
  })
}

// 更新商品分类数据
export async function updateCategory(params) {
  console.log('更新商品分类数据')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/updateCategory',
    data: {
      ...params
    }
  })
}

// 单cloud路径转换http路径
export async function cloudToHttp(params) {
  console.log('单cloud路径转换http路径')
  console.log(params)
  return await axios({
    method: 'post',
    url: baseURL + '/api/cloudToHttp',
    data: {
      params
    }
  })
}
